<ion-header>
    <ion-navbar>
        <ion-title (tap)="selectDep()">
            <span *ngIf="isAdmin">{{currOrg.name}}</span>
            <span *ngIf="!isAdmin">经营分析</span>
            <ion-icon class="menu-icon" name="arrow-down" *ngIf="isAdmin" [class.active]="isShowSheet"></ion-icon>
        </ion-title>
      <ion-buttons end *ngIf="hasOpAuth">
        <button ion-button (click)="moreOp()">操作</button>
      </ion-buttons>
    </ion-navbar>
</ion-header>

<ion-content>
    <ng-container *ngIf="dataState === 1">
        <ng-container *ngFor="let item of analysisResult; let index = index">
            <ion-card class="analysis-item" *ngIf="item.data && item.data.length > 0 && judgeOrg(item.data, currOrg.id)">
                <!--标题-->
                <ion-card-header class="analysis-title">
                    <i>{{index + 1 | number: '2.0-0'}}</i>
                    <h3>{{item.option.name}}</h3>
                </ion-card-header>
                <!--描述和表格-->
                <ion-list>
                    <!--描述-->
                    <ion-item class="analysis-desc">
                        <p>截至{{item.option.date}}，</p>
                        <!--渠道-->
                        <ng-container *ngIf="currOrg.id < 50">
                            <!--描述：100001-->
                            <ng-container *ngIf="item.option.id === 100001">
                                <!--管理员和管理员（条件选择显示）-->
                                <ng-container *ngIf="isAdmin">
                                    <ng-container *ngFor="let item_1 of item.data; let index_1 = index">
                                        <ng-container *ngIf="currOrg.id === 0">
                                            <p *ngIf="item_1.col1 === '总计'">
                                                <span>{{item_1.topareaname}}存量{{item_1.col1}}：{{item_1.col2}}亿，</span>
                                                <span>今年变动：</span>
                                                <trend isArrow="true" [amount]="item_1.col4"></trend>
                                                <span>亿</span>
                                                <end-symbol [length]="item.data.length" [index]="index_1"></end-symbol>
                                            </p>
                                        </ng-container>
                                        <ng-container *ngIf="currOrg.id !== 0 && currOrg.id == item_1.l_order_no">
                                            <p>
                                                <span *ngIf="item_1.l_flag === '0'">{{item_1.topareaname}}</span><span>{{item_1.col1}}存量：{{item_1.col2}}亿，</span>
                                                <span>今年变动：</span>
                                                <trend isArrow="true" [amount]="item_1.col4"></trend>
                                                <span>亿</span>
                                                <span *ngIf="item_1.l_flag !== '1'">；</span>
                                                <span *ngIf="item_1.l_flag === '1'">。</span>
                                            </p>
                                        </ng-container>
                                    </ng-container>
                                </ng-container>
                                <!--非管理员-->
                                <ng-container *ngIf="!isAdmin">
                                    <p>
                                        <span>{{item.data[item.data.length - 1].topareaname}}存量{{item.data[item.data.length - 1].col1}}：{{item.data[item.data.length - 1].col2}}亿，</span>
                                        <span>今年变动：</span>
                                        <trend isArrow="true" [amount]="item.data[item.data.length - 1].col4"></trend>
                                        <span>亿</span>
                                        <span>。</span>
                                    </p>
                                    <ng-container *ngFor="let item_1 of item.data; let index_1 = index">
                                        <p *ngIf="index_1 !== item.data.length - 1">
                                            <span>{{item_1.col1}}存量：{{item_1.col2}}亿，</span>
                                            <span>今年变动：</span>
                                            <trend isArrow="true" [amount]="item_1.col4"></trend>
                                            <span>亿</span>
                                            <span *ngIf="index_1 < item.data.length - 2">；</span>
                                            <span *ngIf="index_1 === item.data.length - 2">。</span>
                                        </p>
                                    </ng-container>
                                </ng-container>
                            </ng-container>
                            <!--描述：100002-->
                            <ng-container *ngIf="item.option.id === 100002">
                                <ng-container *ngFor="let item_2 of item.data; let index_2 = index">
                                    <!--管理员-->
                                    <ng-container *ngIf="isAdmin && currOrg.id === 0">
                                        <p *ngIf="item_2.l_flag === '0'">
                                            <span>{{item_2.topareaname}}今年公募产品净申购额最大的渠道：{{item_2.col1}}，</span>
                                            <span>保有规模：{{item_2.col2}}亿，</span>
                                            <span>今年净申购额：</span>
                                            <trend [amount]="item_2.col5"></trend>
                                            <span>亿</span>
                                        </p>
                                        <ng-container *ngIf="item_2.l_flag === '1'">
                                            <end-symbol [length]="item.data.length" [index]="index_2"></end-symbol>
                                        </ng-container>
                                    </ng-container>
                                    <!--非管理员和管理员（条件选择显示）-->
                                    <ng-container *ngIf="!isAdmin || (isAdmin && (currOrg.id !== 0 && currOrg.id == item_2.l_order_no))">
                                        <p *ngIf="item_2.l_flag === '0' || item_2.l_flag === '1'">
                                            <span *ngIf="item_2.l_flag === '0'">{{item_2.topareaname}}今年公募产品净申购额最大的渠道：{{item_2.col1}}，</span>
                                            <span *ngIf="item_2.l_flag === '1'">今年公募产品净申购额最小的渠道：{{item_2.col1}}，</span>
                                            <span>保有规模：{{item_2.col2}}亿，</span>
                                            <span>今年净申购额：</span>
                                            <trend [amount]="item_2.col5"></trend>
                                            <span>亿</span>
                                            <span *ngIf="item_2.l_flag === '0'">；</span>
                                            <ng-container *ngIf="!isAdmin && item_2.l_flag === '1'">
                                                <end-symbol [length]="item.data.length" [index]="index_2"></end-symbol>
                                            </ng-container>
                                            <span *ngIf="(isAdmin && (currOrg.id !== 0 && currOrg.id == item_2.l_order_no)) && item_2.l_flag === '1'">。</span>
                                        </p>
                                    </ng-container>
                                </ng-container>
                            </ng-container>
                            <!--描述：100003-->
                            <ng-container *ngIf="item.option.id === 100003">
                                <ng-container *ngFor="let item_3 of item.data; let index_3 = index">
                                    <ng-container *ngIf="currOrg.id === 0">
                                        <p *ngIf="item_3.l_flag === '0'">
                                            <span>{{item_3.topareaname}}今年公募产品认购金额最大的渠道：{{item_3.col1}}，</span>
                                            <span>保有规模：{{item_3.col2}}亿，</span>
                                            <span>今年认购额：</span>
                                            <trend [amount]="item_3.col3"></trend>
                                            <span>亿</span>
                                        </p>
                                        <p *ngIf="item_3.l_flag === '1'">
                                            <end-symbol [length]="item.data.length" [index]="index_3"></end-symbol>
                                        </p>
                                    </ng-container>
                                    <ng-container *ngIf="currOrg.id !== 0 && currOrg.id == item_3.l_order_no">
                                        <p *ngIf="item_3.l_flag === '0'">
                                            <span>{{item_3.topareaname}}今年公募产品认购金额最大的渠道：{{item_3.col1}}，</span>
                                            <span>保有规模：{{item_3.col2}}亿，</span>
                                            <span>今年认购额：</span>
                                            <trend [amount]="item_3.col3"></trend>
                                            <span>亿</span>
                                            <span>。</span>
                                        </p>
                                    </ng-container>
                                </ng-container>
                            </ng-container>
                            <!--描述：100004-->
                            <ng-container *ngIf="item.option.id === 100004">
                                <ng-container *ngFor="let item_4 of item.data; let index_4 = index">
                                    <ng-container *ngIf="currOrg.id === 0">
                                        <p *ngIf="item_4.l_flag === '0'">
                                            <span>{{item_4.topareaname}}今年定投新增金额最大的渠道：{{item_4.col1}}，</span>
                                            <span>保有规模：{{item_4.col2}}亿，</span>
                                            <span>今年定投新增金额：</span>
                                            <trend [amount]="item_4.col5"></trend>
                                            <span>亿</span>
                                        </p>
                                        <p *ngIf="item_4.l_flag === '1'">
                                            <end-symbol [length]="item.data.length" [index]="index_4"></end-symbol>
                                        </p>
                                    </ng-container>
                                    <ng-container *ngIf="currOrg.id !== 0 && currOrg.id == item_4.l_order_no">
                                        <p *ngIf="item_4.l_flag === '0'">
                                            <span>{{item_4.topareaname}}今年定投新增金额最大的渠道：{{item_4.col1}}，</span>
                                            <span>保有规模：{{item_4.col2}}亿，</span>
                                            <span>今年定投新增金额：</span>
                                            <trend [amount]="item_4.col5"></trend>
                                            <span>亿</span>
                                            <span>。</span>
                                        </p>
                                    </ng-container>
                                </ng-container>
                            </ng-container>
                        </ng-container>
                        <!--机构-->
                        <ng-container *ngIf="currOrg.id === 0 || currOrg.id >= 50">
                            <!--描述：100005-->
                            <ng-container *ngIf="item.option.id === 100005">
                                <ng-container *ngFor="let item_5 of item.data; let index_5 = index">
                                    <p *ngIf="item_5.col1 === '总计'">
                                        <span>{{item_5.topareaname}}存量{{item_5.col1}}：{{item_5.col2}}亿，</span>
                                        <span>今年变动：</span>
                                        <trend isArrow="true" [amount]="item_5.col5"></trend>
                                        <span>亿</span>
                                        <span *ngIf="item.data.length > 1">；</span>
                                        <span *ngIf="item.data.length === 1">。</span>
                                    </p>
                                </ng-container>
                                <ng-container *ngFor="let item_5 of item.data; let index_5 = index">
                                    <p *ngIf="item_5.col1 !== '总计'">
                                        <span>{{item_5.col1}}存量：{{item_5.col2}}亿，</span>
                                        <span>今年变动：</span>
                                        <trend isArrow="true" [amount]="item_5.col5"></trend>
                                        <span>亿</span>
                                        <span *ngIf="index_5 < item.data.length - 2">；</span>
                                        <span *ngIf="index_5 === item.data.length - 2">。</span>
                                    </p>
                                </ng-container>
                            </ng-container>
                            <!--描述：100006-->
                            <ng-container *ngIf="item.option.id === 100006">
                                <p *ngFor="let item_6 of item.data; let index_6 = index">
                                    <span *ngIf="index_6 === 0">{{item_6.topareaname}}一级策略中，</span>
                                    <span>{{item_6.col1}}存量：{{item_6.col2}}亿，</span>
                                    <span>今年变动：</span>
                                    <trend isArrow="true" [amount]="item_6.col5"></trend>
                                    <span>亿</span>
                                    <end-symbol [length]="item.data.length" [index]="index_6"></end-symbol>
                                </p>
                            </ng-container>
                            <!--描述：100007-->
                            <ng-container *ngIf="item.option.id === 100007">
                                <ng-container *ngFor="let item_7 of item.data; let index_7 = index">
                                    <p *ngIf="item_7.l_flag === '0' || item_7.l_flag === '1'">
                                        <span *ngIf="item_7.l_flag === '0'">{{item_7.topareaname}}今年净申购量最大的客户：{{item_7.col1}}，</span>
                                        <span *ngIf="item_7.l_flag === '1'">今年净申购量最小的客户：{{item_7.col1}}，</span>
                                        <span>保有规模：{{item_7.col2}}亿，</span>
                                        <span>今年净申购额：</span>
                                        <trend [amount]="item_7.col5"></trend>
                                        <span>亿</span>
                                        <span *ngIf="item_7.l_flag === '0' && index_7 < item.data.length - 1">；</span>
                                        <end-symbol *ngIf="item_7.l_flag === '1'" [length]="item.data.length" [index]="index_7"></end-symbol>
                                    </p>
                                </ng-container>
                            </ng-container>
                            <!--描述：100008-->
                            <ng-container *ngIf="item.option.id === 100008">
                                <ng-container *ngFor="let item_8 of item.data; let index_8 = index">
                                    <p *ngIf="item_8.l_flag === '0'">
                                        <span>{{item_8.topareaname}}今年认购金额最大的客户：{{item_8.col1}}，</span>
                                        <span>保有规模：{{item_8.col2}}亿，</span>
                                        <span>今年认购额：</span>
                                        <trend [amount]="item_8.col3"></trend>
                                        <span>亿</span>
                                        <span>。</span>
                                    </p>
                                </ng-container>
                            </ng-container>
                        </ng-container>
                    </ion-item>
                    <!--表格-->
                    <ion-item class="analysis-table">
                        <!--渠道-->
                        <ng-container *ngIf="currOrg.id < 50">
                            <!--表格：100001-->
                            <ng-container *ngIf="item.option.id === 100001">
                                <ion-row class="analysis-table-thead">
                                    <ion-col col-3 *ngIf="isAdmin">{{item.option.field[0]}}</ion-col>
                                    <ion-col col-3>{{item.option.field[1]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[2]}}</ion-col>
                                    <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item.option.field[3]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[4]}}</ion-col>
                                </ion-row>
                                <ng-container *ngFor="let item_1 of item.data">
                                    <!--管理员和非管理员-->
                                    <ion-row class="analysis-table-tbody" *ngIf="currOrg.id === 0" [ngClass]="setBgClolor(item_1.l_order_no)">
                                        <ion-col col-3 *ngIf="isAdmin">{{item_1.topareaname}}</ion-col>
                                        <ion-col col-3>{{item_1.col1}}</ion-col>
                                        <ion-col class="data-align" col-3>{{item_1.col2}}</ion-col>
                                        <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item_1.col3}}</ion-col>
                                        <ion-col class="data-align" col-3>
                                            <trend [amount]="item_1.col4"></trend>
                                        </ion-col>
                                    </ion-row>
                                    <!--管理员（条件选择显示）-->
                                    <ion-row class="analysis-table-tbody" *ngIf="currOrg.id !== 0 && currOrg.id == item_1.l_order_no" [ngClass]="setBgClolor(item_1.l_order_no)">
                                        <ion-col col-3>{{item_1.topareaname}}</ion-col>
                                        <ion-col col-3>{{item_1.col1}}</ion-col>
                                        <ion-col class="data-align" col-3>{{item_1.col2}}</ion-col>
                                        <ion-col class="data-align" col-3>
                                            <trend [amount]="item_1.col4"></trend>
                                        </ion-col>
                                    </ion-row>
                                </ng-container>
                            </ng-container>
                            <!--表格：100002和100004-->
                            <ng-container *ngIf="item.option.id === 100002 || item.option.id === 100004">
                                <ion-row class="analysis-table-thead">
                                    <ion-col col-3 *ngIf="isAdmin">{{item.option.field[0]}}</ion-col>
                                    <ion-col col-3>{{item.option.field[1]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[2]}}</ion-col>
                                    <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item.option.field[4]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[5]}}</ion-col>
                                </ion-row>
                                <ng-container *ngFor="let item_2_4 of item.data">
                                    <!--管理员和非管理员-->
                                    <ion-row class="analysis-table-tbody" *ngIf="currOrg.id === 0" [ngClass]="setBgClolor(item_2_4.l_order_no)">
                                        <ion-col col-3 *ngIf="isAdmin">{{item_2_4.topareaname}}</ion-col>
                                        <ion-col col-3>{{item_2_4.col1}}</ion-col>
                                        <ion-col class="data-align" col-3>{{item_2_4.col2}}</ion-col>
                                        <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item_2_4.col4}}</ion-col>
                                        <ion-col class="data-align" col-3>
                                            <trend [amount]="item_2_4.col5"></trend>
                                        </ion-col>
                                    </ion-row>
                                    <!--管理员（条件选择显示）-->
                                    <ion-row class="analysis-table-tbody" *ngIf="currOrg.id !== 0 && currOrg.id == item_2_4.l_order_no" [ngClass]="setBgClolor(item_2_4.l_order_no)">
                                        <ion-col col-3>{{item_2_4.topareaname}}</ion-col>
                                        <ion-col col-3>{{item_2_4.col1}}</ion-col>
                                        <ion-col class="data-align" col-3>{{item_2_4.col2}}</ion-col>
                                        <ion-col class="data-align" col-3>
                                            <trend [amount]="item_2_4.col5"></trend>
                                        </ion-col>
                                    </ion-row>
                                </ng-container>
                            </ng-container>
                            <!--表格：100003-->
                            <ng-container *ngIf="item.option.id === 100003">
                                <ion-row class="analysis-table-thead">
                                    <ion-col col-3 *ngIf="isAdmin">{{item.option.field[0]}}</ion-col>
                                    <ion-col col-3>{{item.option.field[1]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[2]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[3]}}</ion-col>
                                    <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item.option.field[4]}}</ion-col>
                                </ion-row>
                                <ng-container *ngFor="let item_3 of item.data">
                                    <!--管理员和非管理员-->
                                    <ion-row class="analysis-table-tbody" *ngIf="currOrg.id === 0" [ngClass]="setBgClolor(item_3.l_order_no)">
                                        <ion-col col-3 *ngIf="isAdmin">{{item_3.topareaname}}</ion-col>
                                        <ion-col col-3>{{item_3.col1}}</ion-col>
                                        <ion-col class="data-align" col-3>{{item_3.col2}}</ion-col>
                                        <ion-col class="data-align" col-3>
                                            <trend [amount]="item_3.col3"></trend>
                                        </ion-col>
                                        <ion-col class="data-align" col-3 *ngIf="!isAdmin">
                                            <trend [amount]="item_3.col4"></trend>
                                        </ion-col>
                                    </ion-row>
                                    <!--管理员（条件选择显示）-->
                                    <ion-row class="analysis-table-tbody" *ngIf="currOrg.id !== 0 && currOrg.id == item_3.l_order_no" [ngClass]="setBgClolor(item_3.l_order_no)">
                                        <ion-col col-3>{{item_3.topareaname}}</ion-col>
                                        <ion-col col-3>{{item_3.col1}}</ion-col>
                                        <ion-col class="data-align" col-3>{{item_3.col2}}</ion-col>
                                        <ion-col class="data-align" col-3>
                                            <trend [amount]="item_3.col3"></trend>
                                        </ion-col>
                                    </ion-row>
                                </ng-container>
                            </ng-container>
                        </ng-container>
                        <!--机构-->
                        <ng-container *ngIf="currOrg.id === 0 || currOrg.id >= 50">
                            <!--表格：100005和100006-->
                            <ng-container *ngIf="item.option.id === 100005 || item.option.id === 100006">
                                <ion-row class="analysis-table-thead">
                                    <ion-col col-2-4 *ngIf="isAdmin">{{item.option.field[0]}}</ion-col>
                                    <ion-col col-2-4>{{item.option.field[1]}}</ion-col>
                                    <ion-col class="data-align" col-2-4>{{item.option.field[2]}}</ion-col>
                                    <ion-col class="data-align" col-2-4>{{item.option.field[3]}}</ion-col>
                                    <ion-col class="data-align" col-2-4 *ngIf="!isAdmin">{{item.option.field[4]}}</ion-col>
                                    <ion-col class="data-align" col-2-4>{{item.option.field[5]}}</ion-col>
                                </ion-row>
                                <ion-row class="analysis-table-tbody" *ngFor="let item_5_6 of item.data" [ngClass]="setBgClolor(item_5_6.l_order_no)">
                                    <ion-col col-2-4 *ngIf="isAdmin">{{item_5_6.topareaname}}</ion-col>
                                    <ion-col col-2-4>{{item_5_6.col1}}</ion-col>
                                    <ion-col class="data-align" col-2-4>{{item_5_6.col2}}</ion-col>
                                    <ion-col class="data-align" col-2-4>{{item_5_6.col3}}</ion-col>
                                    <ion-col class="data-align" col-2-4 *ngIf="!isAdmin">
                                        <trend [amount]="item_5_6.col4"></trend>
                                    </ion-col>
                                    <ion-col class="data-align" col-2-4>
                                        <trend [amount]="item_5_6.col5"></trend>
                                    </ion-col>
                                </ion-row>
                            </ng-container>
                            <!--表格：100007-->
                            <ng-container *ngIf="item.option.id === 100007">
                                <ion-row class="analysis-table-thead">
                                    <ion-col col-3 *ngIf="isAdmin">{{item.option.field[0]}}</ion-col>
                                    <ion-col col-3>{{item.option.field[1]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[2]}}</ion-col>
                                    <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item.option.field[4]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[5]}}</ion-col>
                                </ion-row>
                                <ion-row class="analysis-table-tbody" *ngFor="let item_7 of item.data" [ngClass]="setBgClolor(item_7.l_order_no)">
                                    <ion-col col-3 *ngIf="isAdmin">{{item_7.topareaname}}</ion-col>
                                    <ion-col col-3>{{item_7.col1}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item_7.col2}}</ion-col>
                                    <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item_7.col4}}</ion-col>
                                    <ion-col class="data-align" col-3>
                                        <trend [amount]="item_7.col5"></trend>
                                    </ion-col>
                                </ion-row>
                            </ng-container>
                            <!--表格：100008-->
                            <ng-container *ngIf="item.option.id === 100008">
                                <ion-row class="analysis-table-thead">
                                    <ion-col col-3 *ngIf="isAdmin">{{item.option.field[0]}}</ion-col>
                                    <ion-col col-3>{{item.option.field[1]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[2]}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item.option.field[3]}}</ion-col>
                                    <ion-col class="data-align" col-3 *ngIf="!isAdmin">{{item.option.field[4]}}</ion-col>
                                </ion-row>
                                <ion-row class="analysis-table-tbody" *ngFor="let item_8 of item.data" [ngClass]="setBgClolor(item_8.l_order_no)">
                                    <ion-col col-3 *ngIf="isAdmin">{{item_8.topareaname}}</ion-col>
                                    <ion-col col-3>{{item_8.col1}}</ion-col>
                                    <ion-col class="data-align" col-3>{{item_8.col2}}</ion-col>
                                    <ion-col class="data-align" col-3>
                                        <trend [amount]="item_8.col3"></trend>
                                    </ion-col>
                                    <ion-col class="data-align" col-3 *ngIf="!isAdmin">
                                        <trend [amount]="item_8.col4"></trend>
                                    </ion-col>
                                </ion-row>
                            </ng-container>
                        </ng-container>
                    </ion-item>
                </ion-list>
            </ion-card>
        </ng-container>
    </ng-container>
    <div class="no-data" *ngIf="dataState === 2">暂无更多数据...</div>
</ion-content>
